pp108 : Generation of Layouts from Methods

Generation of Layouts from Methods

This topic describes the layouts generated from methods.

The XForms Designer provides various controls that can be dragged from the Toolbox tab to generate layouts. The data types, formats, and properties of these controls are then defined and the fields are validated.

However, XForms provides a much quicker way of generating both input and output user interfaces. It is possible to generate a default UI and the model necessary to send and receive data from the backend using a Process Platform Web service (Web service operation) or the WSDL of any external Web service.

When a Process Platform Web service operation is dragged and dropped to the XForms Designer or a WSDL is imported, a model is created automatically and Designer Area displays a default layout ofthe XForm based on the WSDL. You can retain the default layout or choose another layout for the XForm using the Layout option.

Note:
If the Web service operation that is dragged does not have a WSDL, the model is created with only a Groupbox control on the XForm. You need to manually create the controls required on such an XForm.

Generation of Default Layouts

The default layouts generated by the XForms Designer depend on the type of Process Platform Web service operations generated using the Web Service Generator.
The following are the basic methods available in the _Web Service Generator_for any table in a database:

  • Get<TableName>Object: This Web service operation returns zero or one record from the database.
  • Get<TableName>Objects: This Web service operation returns zero or more records from the backend.
  • GetNext<TableName>Objects: This Web service operation returns the next set of records, greater than a specified key value, from the backend.
  • GetPrevious<TableName>Objects: This Web service operation returns the previous set of records, less than a specified key value, from the backend.

Note:
The key value is usually the parameter (primary key) used to query for theGetObjectandGetObjectsmethods.

Custom methods can also be generated using the Query Builder provided by the Process Platform application. Such methods can be interpreted by the XForms Designer to propose a default layout.

Types of Layouts

The following layouts are proposed by the XForms Designer using the above mentioned methods:

  • Form layout (Details view)
  • Grid layout (List view)
  • Aggregated layout (Details-List view)
Form Layout

Using the Get<TableName>Object Web service operation, the XForms Designer proposes a Form layout. Since data returned is zero or one, all the fields retrieved from the Web service operation are displayed in a Groupbox control as a detailed view. If the same Web service interface has the GetNext<TableName>Objects and GetPrevious<TableName>Objects methods, the Groupbox control is generated with an element bar to navigate through detailed records.

Since the Next and Previous methods always return multiple records from the backend, it is necessary to retrieve a manageable number of records from the backend considering the time taken to retrieve and render the data in client. This is handled in XForms by using a server-side cursor (Iterator Size) that can be specified on a model. By default, Iterator Size is 50, that is 50 records can be retrieved from the backend at a time, and a fresh request needs to be sent to the database if this limit is exhausted.

Any custom Web service operation that returns only a single record will result in a Groupbox control generated in the XForms Designer.

Grid Layout

Using the Get<TableName>Objects Web service operation, the XForms Designer proposes a grid (table) layout. The data returned is always zero or more, so all fields retrieved are shown in a table as a list view. Since this Web service operation itself retrieves a range of records, theGetNextorGetPreviousmethods are not needed.

Note:
Process Platform recommends that you do not use the GetNext or GetPrevious methods with the Get<TableName>Objects Web service operation. If you do set the GetNext or GetPrevious methods in the model property sheet of the Get<TableName>Objects Web service operation, a notification displays and the Get<TableName>Objects Web service operation is automatically changed to the Get<TableName>Object Web service operation.

Any custom Web service operation that returns more than one record will result in a Grid generated in the XForms Designer.

Aggregated Layout

Aggregated methods for any table can be generated using the Query Builder tool available in Process Platform. These methods have complex responses. For such methods, the XForms Designer proposes an aggregate layout that is a combination of both detail and list view. This layout occurs when the response is a complex XML. All the fields retrieved from the Web service operation display in a Groupbox control as a detailed view enclosing other controls and grids. If the complexity exceeds 1-N level, the response displays as an XML in a text box.

Consider the following example:

<employees> <ID> <name> <orders> <orderID> <orderdate> <products> <ID> <name> </products> <products> <ID> <name> </products> </orders> <orders> ... </orders> </employees>

For the above response, the Groupbox control displays the employee data, such as ID and name, as input fields, and the orders for each employee in a table. The orders table displays the following:

  • Input controls for order data such asorderIDandorderdate.
  • Textarea control for product data. This data displays as XML as it exceed 1-N complexity level.

In case of complex responses, a Groupbox control will be proposed by the XForms Designer and the element bar for the Groupbox controldepends on the number of records returned by the Web service operation. If the Web service operation returns more than one record, then the element bar is generated for the Groupbox control. If only a single record is returned, element bar will not be generated.

Note:

  • If a Web service interface has all the three methods for a Table that is Get<TableName>Object , GetNext<TableName>Objects , and GetPrevious<TableName>Objects , then dragging any of these methods to the XForms Designer generates a Groupbox control with an element bar. This applies to both default generated methods and Custom methods with the naming convention as above.
  • The different layouts generated are based on the methods used and results returned. For complex layouts, it is possible to generate data only for aggregated relations. Association methods (for example, Get<TableName1>With<TableName2>Objects) are not supported. In such scenarios, you can use separate Object or Objects methods for the database tables, and associate them using XForms data model.

Layouts Generated from Various Web Service Operation Combinations

The following table shows the layouts generated when various combinations of methods are dragged to an XForm:

Web Service Operation Combinations

Expected Result

Get<TableName>Object

A Groupbox control is generated. You can see one record in a detailed view at a time.

Get<TableName>Object and Web service interface has the GetNext and GetPervious methods

A Groupbox control with an element bar is generated. Using the pagination bar, you can navigate between records. As the Groupbox control displays only one record at a time, you can convert the UI to a table to view records page by page.

Get<TableName>Objects

A Table control is generated where all records appear in a list view. The number of records viewed depends on the height of the table.

Get<TableName>Objects and Web service interface also has the GetNext and GetPrevious methods

Process Platform recommends that you do not use the GetNext or GetPrevious methods with the Get<TableName>Objects Web service operation. If you do set the GetNext or GetPrevious methods for the Get<TableName>Objects Web service operation, a notification displays and the Get<TableName>Objects Web service operation is automatically changed to the Get<TableName>Object Web service operation. On again, programmatically setting the GetNext or GetPrevious methods with the Get<TableName>Objects Web service operation, duplicate records are retrieved from the backend.

GetNext<TableName>Objects or GetPrevious<TableName>Objects

Generates a form layout if the Web service operation has a GetObject Web service operation and grid layout if it has a GetObjects Web service operation, in the above order of preference. If GetObject Web service operation is available, then all three methods are used.

Note:
Once a default layout is proposed, it is also possible to change the layout to other grouping controls such asTab Page, Table, and Groupbox using the Change To context-menu option of the XForm.

For an external Web service, XForms designer parses its WSDL and proposes a suitable layout depending on the response of the service. If the service returns only a single record, the XForms Designer proposes the Groupbox control. If the service returns more than one record, then a Grid is proposed. In case of complex responses, a Groupbox control is proposed and the element bar of the Groupbox control depends on the number of records returned by the service. The element bar is generated by default when more than one record is returned by the service.

Default Controls

Depending on the WSDL or XSD of the Web service operation that you select, Process Platform XForms generates various controls inside a Groupbox control or a Table control. The following table provides information about the automatically generated controls:

XSD Definition

Controls Generated

Input/Output

Elements of all types except boolean.
For elements of type date, the input control will contain the calendar look-up button.

Note:

  • If the Web service interface to which the selected Web service operation belongs also contains an Update Web service operation, then only input controls are generated, else only output controls are generated.
  • If the element has a fixed attribute defined in the WSDL/XSD, then the output control is generated even if the Web service interface contains an Update Web service operation.

Select

Elements that have enumerated data defined in the WSDL/XSD.

Check

Elements of the type boolean.

Textarea

  • Element types that are identified as any in the WSDL.
  • Element length greater than 80.

Table

For elements of the array type, Process Platform XForms generates a table and sets the reference to table as "*". This leads to errors when you insert a row in to the table at run time.

Query Builder

The Query Builder can be used to generate associate and aggregate queries. Those queries generally retrieve data from more than one table using the relational constraints between the tables. XForms does not support generating a UI for the association queries, but still association can be achieved in the UI by the following procedure.

Consider two tables - Table1 and Table2 - that are associated to each other. Instead of using the default generated associated methods, association can be achieved by the following steps:

  1. Generate Get<Table1>Objects Web service operation for Table1 and Get<Table2>Objects Web service operation for Table2.
  2. While drag-dropping the methods, XForms designer asks for associating the models generated. Select*Yes*to associate model for Table1 and Table2.
  3. Check if the necessary relation between the constraint fields (Generally the foreign key of Table1 and primary key of Table2) are set correctly in the model properties.

Custom Layouts

Though default layouts are proposed when the designer understands the relationship between the methods dragged, the developer also might need to create some composite layouts in order to match user requirements. Some of the custom layouts might demand a developer to show multiple views of the same model, can involve associating models to synchronize the data shown between multiple views of the model. The composite layout consists of at least two views: a main view and an associated view.

The composite views can be:

  • From same data source: Since data source is same, developer can use a single model and use it as data source for both the views (Groupbox and Table). Data in such cases will be synchronized between views automatically.
  • From different data sources: Models need to be associated. Once a model is dragged into the page, designer asks the developer whether to associate the models. The designer analyzes the relation between models and establishes an automatic relation when the constraints are known. Otherwise, developer has to manually set relations. It is possible to achieve multi-step associated layouts also, where Table1 is related to Table2, Table2 to Table3 and so on.
Remarks

Associating views can also be achieved between pages. This also ensures synchronization of data between models. Refer to table properties for more information.
In the case of composite layouts, there should be at least one parameter that associates the main view with the associated views. If this is not ensured, the results could be erroneous.

Navigation

Navigation feature enables the user to browse the records. This feature is functional in the following cases.

  1. Get Web service operation returning more than one record.
  2. Next and Previous methods are set in the model.

If the UI proposed by the XForms Designer does not have the element bar, you can add an element bar to the Groupbox or the grid and attach the Next and Previous methods to the model to get the navigation functional.

Find Feature

All Web service operation-based forms which have parameters to retrieve data have the Find feature enabled by default. This option helps the user to find records from the current data set position. The functionality of the Find feature may vary depending on the type of Web service operation chosen and the layout proposed:

  • Form layout: If there is only aGet<TableName>ObjectWeb service operation, Find works if the Web service operation has at least a parameter to retrieve data.
  • Grid layout: Same as above.
  • Other layouts: If the layout has association between the models, Find can work only if the Web service operation has a reference attribute and one or more additional parameters to retrieve data. For example, if Field1 of Table1 is a foreign key in Table2 and Field2 is primary key of Table2, then Find works when Table1 is associated to Table2.
  • Non-Process Platform protocol layouts: Find feature is not enabled.

Related tasks

Creating XForms using Web Services